CMAKE_MINIMUM_REQUIRED(VERSION 3.10)
PROJECT(rk3588_sdk)
set(TARGET_NAME rk3588_sdk)

SET(CMAKE_CXX_STANDARD "17")
SET(CMAKE_C_STANDARD "17")


include_directories("src/prot_tcp")
# add file dir
list( APPEND LIST_DIR  "src")
list( APPEND LIST_DIR  "src/prot_tcp")


foreach( dir  ${LIST_DIR} )
    message( STATUS ${dir})
    FILE( GLOB  SRC_LIST "${PROJECT_SOURCE_DIR}/${dir}/*.cpp")
    list(APPEND ALL_SRC_LIST ${SRC_LIST})
    include_directories(AFTER ${dir})
endforeach()


if( "${TYPE}" STREQUAL "TEST")
    add_definitions(-DTEST)
elseif("${TYPE}" STREQUAL "DEBUG")
    add_definitions(-DDEBUG)
    SET(CMAKE_BUILD_TYPE "Debug")   
else()    
    SET(CMAKE_BUILD_TYPE "Release")
endif()



if( "${PLT}" STREQUAL "RK3399")
    add_definitions(-DEVK_RK3399)
    #set(CMAKE_SYSROOT "/opt/FriendlyARM/toolchain/6.4-aarch64/aarch64-cortexa53-linux-gnu/sysroot")
    #set(CMAKE_SYSROOT "/home/gaowei/Disk/work/Rockchip/rk3588/target")
    #set(CMAKE_C_COMPILER "aarch64-linux-gnu-gcc-12")
    #set(CMAKE_CXX_COMPILER "aarch64-linux-gnu-g++-12")  
    #LINK_DIRECTORIES(/home/gaowei/Disk/work/Rockchip/rk3588/target/usr/aarch64-linux-gnu /home/gaowei/Disk/work/Rockchip/rk3588/target/lib)
endif()




#add_executable( ${TARGET_NAME} ${ALL_SRC_LIST})
add_library( ${TARGET_NAME}  SHARED ${ALL_SRC_LIST} )
target_link_libraries(${TARGET_NAME} pthread  ) 



# version info
string( TIMESTAMP  COMPILE_TIME "%Y-%m-%d %H:%M:%S " )
add_definitions(-DCOMPILE_TIME="${COMPILE_TIME}")
add_definitions(-DVER="1.0")
site_name(host)
add_definitions(-DHOST="${host}")


set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")

SET(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g2 -ggdb ")
SET(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O3 -Wall ")

